package com.lenovo.nova.widget.dialog;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;

import com.lenovo.nova.utils.R;
import com.lenovo.nova.widget.baseview.CustomTextView;


public class WaitDialog  {

	private CustomTextView messageText;
	private ProgressBar mProgress;
	private View mainView;
	private BaseDialog mDialog;
	private Context mContext;
	public WaitDialog(Context context) {
		mContext = context;
		initMainView();
		mDialog = new BaseDialog(context);
		mDialog.setContentView(mainView);
	}
	
	public void show(){
		mDialog.show();
	}
	
	private void initViewStyle(View rootView) {
		mProgress.getLayoutParams().width = 150;
		mProgress.getLayoutParams().height = 150;
		messageText.setTextSize(mContext.getResources().getDimension(R.dimen.scenic_util_middleFont));
		messageText.setText("Loading");
	}
	
	public void setMessage(String txt){
		initMainView();
		messageText.setText(txt);
	}
	
	public void initMainView(){
		if(mainView == null){
			mainView = LayoutInflater.from(mContext).inflate(R.layout.layout_wait_dialog_style_1, null, false);
		}
		
		mProgress = (ProgressBar) mainView.findViewById(R.id.id_prgrsbar_waitdialog_1);
		
		messageText	 = (CustomTextView) mainView.findViewById(R.id.id_txview_waitdialog_1);
		initViewStyle(mainView);
	}
	
}
